package com.kkwrite.regimen.common.entity.dto.order;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

import static com.kkwrite.regimen.common.constant.Constant.STAR_MAX_LEVEL;
import static com.kkwrite.regimen.common.constant.Constant.STAR_MIN_LEVEL;

/**
 * Created by lisha on 2018/7/22 16:19.
 *
 * @author lisha
 */
public class OrderReviewSubmitInDTO implements Serializable {
    private static final long serialVersionUID = 3626868519092569916L;
    private final List<Integer> sourceList = Arrays.asList(1, 2);

    private String orderCode;
    private Integer comprehensiveEvaluationLevel;
    private String[] reviewLabels;
    private String reviewContent;
    private String[] imagePaths;
    /**
     * 评价来源（1用户2商家）
     */
    private Integer source;

    public boolean isEmpty() {
        if (this.orderCode == null || this.orderCode.trim().isEmpty()) {
            return true;
        }
        if (this.comprehensiveEvaluationLevel < STAR_MIN_LEVEL || this.comprehensiveEvaluationLevel > STAR_MAX_LEVEL) {
            return true;
        }
        return !sourceList.contains(source);
    }

    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public Integer getComprehensiveEvaluationLevel() {
        return comprehensiveEvaluationLevel;
    }

    public void setComprehensiveEvaluationLevel(Integer comprehensiveEvaluationLevel) {
        this.comprehensiveEvaluationLevel = comprehensiveEvaluationLevel;
    }

    public String[] getReviewLabels() {
        return reviewLabels;
    }

    public void setReviewLabels(String[] reviewLabels) {
        this.reviewLabels = reviewLabels;
    }

    public String getReviewContent() {
        return reviewContent;
    }

    public void setReviewContent(String reviewContent) {
        this.reviewContent = reviewContent;
    }

    public String[] getImagePaths() {
        return imagePaths;
    }

    public void setImagePaths(String[] imagePaths) {
        this.imagePaths = imagePaths;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    @Override
    public String toString() {
        return "OrderReviewSubmitInDTO{" +
                "orderCode='" + orderCode + '\'' +
                ", comprehensiveEvaluationLevel=" + comprehensiveEvaluationLevel +
                ", reviewLabels=" + Arrays.toString(reviewLabels) +
                ", reviewContent='" + reviewContent + '\'' +
                ", imagePaths=" + Arrays.toString(imagePaths) +
                ", source=" + source +
                '}' + "; " + super.toString();
    }
}
